import styles from '../css分支/My_gonggao.module.css'
import { Arrow, ArrowLeft, Close, ClockO } from '@react-vant/icons';
import { useNavigate } from 'react-router-dom';
import { Tabs, Search } from 'react-vant'
import axios from 'axios';
import React, { useEffect, useRef, useState } from 'react'
import { Card, Price, Tag } from '@nutui/nutui-react'
import { Checkbox, Cell } from '@nutui/nutui-react'
import { Button, Switch } from 'react-vant'
import { TextArea,Toast,Space, } from 'antd-mobile'

export default function My_gonggao() {
    const [value, setValue] = useState('')
    const navigate = useNavigate()
    const handShang=async()=>{
        let res = await axios.post('http://localhost:3000/xzx/shangchuan',{value})
        if(res.data.code==200){
            getlist()
        }
    }
    const [list,setlist] = useState({})
    const getlist= async()=>{
      let res = await axios.get('http://localhost:3000/xzx/business')
      setlist(res.data.data)
      setValue(res.data.data.gonggao)
    }
    useEffect(()=>{
      getlist()
      
    },[])
    return (
        <div className={styles.main}>
            <div className={styles.head}>
                <ArrowLeft style={{ marginLeft: '0.1rem' }} onClick={() => { navigate('/shou/my') }} />
                <p style={{ fontSize: '0.22rem' }}>店铺公告</p>
                <p style={{ marginRight: '0.1rem' }}></p>
            </div>
            <div className={styles.bodys}>
                <TextArea
                    placeholder='请输入店铺公告'
                    showCount
                    maxLength={400}
                    rows={50}
                    value={value}
                    onChange={val => {
                        setValue(val)
                      }}
                    style={{width:'100%',height:'100%'}}
                />
            </div>
            <div className={styles.body3} onClick={()=>Toast.show({
                icon: 'success',
                content: '保存成功',
              })}>
                <p onClick={()=>handShang()}
                
                >确定修改</p>
            </div>
        </div>
    )
}
